<%@page import="com.farm.parameter.FarmParameterService"%>
<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="com.farm.web.constant.FarmConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<link rel="stylesheet"
	href="view/web-simple/hour/commons/player/text/aliplayer/aliplayer.2.9.3.min.css" />
<script charset="utf-8" type="text/javascript"
	src="view/web-simple/hour/commons/player/text/aliplayer/aliplayer.2.9.3.min.js"></script>
<style type="text/css">
.super_content {
	border-bottom: 0px;
}
/* 隐藏音轨，字幕，清晰度 (隐藏进度条,.prism-progress )*/
.prism-setting-quality, .prism-setting-audio, .prism-setting-cc {
	display: none;
}
</style>
<div
	style="background: #000000; border-radius: 8px; padding-top: 8px; padding-bottom: 6px;">
	<div class="prism-player" id="J_prismPlayer"></div>
</div>
<div
	style="font-size: 12px; color: #666666; float: left; position: relative; top: 2px; height: 1px;">
	<i class=" glyphicon glyphicon-info-sign" id="currentPlaySource"></i>
</div>
<script type="text/javascript">
	var startProcess = 0;
	var isShowMaxBT = true;
</script>
<c:if
	test="${!empty hourview&&!empty hourview.hour&&!empty hourview.hour.continuis&&hourview.hour.continuis=='1'}">
	<script type="text/javascript">
		startProcess = parseInt('${empty hourview.playtime.duration?0:hourview.playtime.duration}');
	</script>
</c:if>
<PF:IfParameterEquals key="config.playing.mobile.max.able" val="false">
	<PF:IfMobile state="true">
		<!-- 如果是移动端，且移动端不支持最大化，就隐藏最大化按钮 -->
		<script type="text/javascript">
			isShowMaxBT = false;
		</script>
	</PF:IfMobile>
</PF:IfParameterEquals>
<script type="text/javascript">
	var height = $(window).height() - 220;
	if (height > 860) {
		height = 860;
	}
	$('#J_prismPlayer').css('height', height);
	var player = new Aliplayer({
		id : 'J_prismPlayer',
		autoplay : true,
		//支持播放地址播放,此播放优先级最高
		source : '${playUrl}',
		//播放方式二：点播用户推荐
		vid : '1e067a2831b641db90d570b6480fbc40',
		playauth : 'ddd',
		cover : 'text/img/demo/playerIcon.png',
		region : 'cn-shanghai',//eu-central-1,ap-southeast-1
		"skinLayout" : [ {
			"name" : "bigPlayButton",
			"align" : "blabs",
			"x" : 30,
			"y" : 80
		}, {
			"name" : "H5Loading",
			"align" : "cc"
		}, {
			"name" : "errorDisplay",
			"align" : "tlabs",
			"x" : 0,
			"y" : 0
		}, {
			"name" : "infoDisplay"
		}, {
			"name" : "tooltip",
			"align" : "blabs",
			"x" : 0,
			"y" : 56
		}, {
			"name" : "thumbnail"
		}, {
			"name" : "controlBar",
			"align" : "blabs",
			"x" : 0,
			"y" : 0,
			"children" : [ {
				"name" : "progress",
				"align" : "blabs",
				"x" : 0,
				"y" : 44
			}, {
				"name" : "playButton",
				"align" : "tl",
				"x" : 15,
				"y" : 12
			}, {
				"name" : "timeDisplay",
				"align" : "tl",
				"x" : 10,
				"y" : 7
			}, {
				"name" : "setting",
				"align" : "tr",
				"x" : 15,
				"y" : 12
			}, {
				"name" : "fullScreenButton",
				"align" : "tr",
				"x" : 10,
				"y" : 12
			}, {
				"name" : "volume",
				"align" : "tr",
				"x" : 5,
				"y" : 10
			} ]
		} ]
	}, function(player) {
		console.log('播放器创建好了。')
	});
	player.on('ready', function(e) {
		if (startProcess > 0) {
			//如果设置了startplaytime则跳转到指定位置
			if (startProcess > 100) {
				startProcess = 100;
			}
			seekPlayedSeccend(getPlayDuration() * startProcess / 100);
		}
		if (!isShowMaxBT) {
			//alert("影藏按钮");
			$('.prism-fullscreen-btn').hide();
		}
		$('#currentPlaySource').attr('title', player.tag.currentSrc);
	});
	player.on('ended', function(e) {
		//播放完成
		openOperatorWin();
	});
	//是否播放状态
	function isPlay() {
		return (player.getStatus() == 'playing');
	}
	//停止视频播放
	function stopPlay() {
		$('.prism-big-play-btn').addClass("pause");
		$('.prism-big-play-btn').removeClass("playing");
		$('.prism-big-play-btn').css("display", "block");
		$('.prism-cover').css("display", "block");
		player.pause();
	}
	//获得当前播放时间（秒）
	function getPlayedSeccend() {
		return player.getCurrentTime();
	}
	//获得视频总长度（秒）
	function getPlayDuration() {
		return player.getDuration();
	}
	//跳转到某个时间点
	function seekPlayedSeccend(seccend) {
		return player.seek(seccend);
	}
</script>

<c:if
	test="${!empty hourview&&!empty hourview.hour&&!empty hourview.hour.progressis&&hourview.hour.progressis=='0'}">
	<script type="text/javascript">
		$('.prism-progress').remove();
	</script>
</c:if>



